// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import VueRouter from 'vue-router'
import Vuex from 'vuex'
import VueLazyload from 'vue-lazyload'
import Mint from 'mint-ui'
import 'mint-ui/lib/style.css'

import Cube from 'cube-ui'
Vue.use(Cube)


// import Mint from 'mint-ui'
// import 'mint-ui/lib/style.css'
import 'font-awesome/css/font-awesome.min.css'
import  VueQuillEditor from 'vue-quill-editor'
Vue.config.productionTip = false

//全局的js错误捕获
const errorHandler = (error, vm)=>{
  window.vue.$message({
      message: "页面异常请稍等",
      type: "error"
  });
  console.error('抛出全局异常');
  console.error(vm);
  console.error(error);
}

//
Vue.config.errorHandler = errorHandler;
Vue.prototype.$throw = (error)=> errorHandler(error,this);

Vue.use(VueRouter)
Vue.use(Vuex)
Vue.use(Mint);

Vue.use(VueQuillEditor)
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
/* eslint-disable no-new */
// 图片懒加载
Vue.use(VueLazyload, {
  loading: '/static/loading-bars.svg'
  // loading: require('@/assets/img/logo.png')
})
// Vue.prototype.$photoUrl="http://171.213.9.101:7654/remotewardrounds/";
Vue.prototype.$photoUrl="http://www.bestckd.com/lungtest/remotewardrounds/";
router.beforeEach((to, from, next) => {
  /* 路由发生变化修改页面title */
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
})

new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
